home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr48 / pas_0593.zip / MOVESCRN.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-30  |  2KB  |  58 lines

  1. {─ Fido Pascal Conference ────────────────────────────────────────────── PASCAL ─
  2. Msg  : 365 of 412
  3. From : Sean Palmer                         1:104/123.0          14 May 93  16:28
  4. To   : Todd Holmes
  5. Subj : TExt screen getImage
  6. ────────────────────────────────────────────────────────────────────────────────
  7. TH>I was looking threw a Turbo C++ manual and noted some
  8. TH>procedures that deal with the text screen, such as
  9. TH>Get/PutTextImage. I was wondering if anyone has created one
  10. TH>for Pascal to move/save Text images around the screen like
  11. TH>in C++.
  12.  
  13. this copies a rectangular section from one video buffer (any size) to
  14.  another}
  15. procedure moveScr(var srcBuf;srcX,srcY,width,height,srcBufW,srcBufH:word;
  16.                   var dstBuf;dstX,dstY,dstBufW,dstBufH:word);assembler;
  17. asm
  18.  cld
  19.  push ds
  20.  lds si,srcBuf    {calc src adr}
  21.  mov ax,srcBufW
  22.  mul srcY
  23.  add ax,srcX
  24.  shl ax,1
  25.  add si,ax
  26.  les di,dstBuf    {calc dst adr}
  27.  mov ax,dstBufW
  28.  mul dstY
  29.  add ax,dstX
  30.  shl ax,1
  31.  add di,ax
  32.  mov dx,height    {num lines}
  33.  mov ax,SrcBufW   {calc ofs between src lines}
  34.  sub ax,width
  35.  shl ax,1
  36.  mov bx,dstBufW   {calc ofs between dst lines}
  37.  sub bx,width
  38.  shl bx,1
  39. @L: mov cx,width
  40.  rep movsw
  41.  add si,ax
  42.  add di,bx
  43.  dec dx
  44.  jnz @L
  45.  pop ds
  46.  end;
  47.  
  48. var s:array[0..24,0..79,0..1]of char absolute $B800:0;
  49. var d:array[0..11,0..39,0..1]of char;
  50.  
  51. var i:integer;
  52. begin
  53.  for i:=1 to 25*10 do write('+---:---');
  54.  moveScr(s,0,0,40,12,80,25,d,0,0,40,12); {copy 40x12 block to buf}
  55.  readln;
  56.  moveScr(d,0,0,38,10,40,12,s,5,5,80,25); {copy part back to screen}
  57.  readln;
  58.  end.